package service.impl;

import com.my.mapper.BranchMapper;
import com.my.pojo.Branch;
import com.my.util.MyBatisUtil;

import java.util.List;

public class BranchServiceImpl {
    BranchMapper branchMapper = MyBatisUtil.openSession().getMapper(BranchMapper.class);

    public List<Branch> getBranchBy(Branch branch) {
        return branchMapper.getBranchBy(branch);
    }

    public Branch getBranchById(Integer branchId) {
        return branchMapper.getBranchById(branchId);
    }

    public boolean isExist(Branch branch){
        List<Branch> branchList =branchMapper.getBranchBy(branch);
        if (null !=branchList && branchList.size()>0){
            return true;
        }
        return false;
    }

    public boolean addBranch (Branch branch){
        return branchMapper.addBranch(branch);
    }
}
